//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Certificate;
import com.hl.sfzy.mapper.CertificateMapper;
import com.hl.sfzy.service.CertificateService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CertificateServiceImpl implements CertificateService {
    @Autowired
    private CertificateMapper certificateMapper;

    public CertificateServiceImpl() {
    }

    public void add(Certificate entity) throws Exception {
        this.certificateMapper.insert(entity);
    }

    public void edit(Certificate entity) {
        this.certificateMapper.update(entity);
    }

    public void remove(Integer id) {
        this.certificateMapper.delete(id);
    }

    public void removeBatch(Integer[] ids) {
        this.certificateMapper.deleteBatch(ids);
    }

    public List<Certificate> find(Certificate entity) {
        return this.certificateMapper.select(entity);
    }

    public Map<String, Object> findPage(Integer pageNum, Integer pageSize, Certificate entity) {
        PageHelper.startPage(pageNum, pageSize);
        List<Certificate> certificates = this.certificateMapper.select(entity);
        PageInfo<Certificate> pageInfo = new PageInfo(certificates);
        Map<String, Object> pageMap = new HashMap();
        pageMap.put("list", certificates);
        pageMap.put("total", pageInfo.getTotal());
        return pageMap;
    }

    public Certificate findById(Integer id) {
        return (Certificate)this.certificateMapper.selectById(id);
    }

    public List<Certificate> selectList() {
        return this.certificateMapper.selectList();
    }
}

